﻿<%@ page contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<!DOCTYPE html>
<head>
<title>新增消息</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="../style/adminStyle.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../js/jquery-3.1.1.min.js"></script>
</head>
<body>
 <div class="wrap">
  <div class="page-title">
    <span class="modular fl"><i class="settings"></i><em>新增消息</em></span>
  </div>
  <table class="noborder">
   <tr>
    <td style="width:15%;text-align:right;"><b>更新版本号：</b></td>
    <td><input type="text" class="textBox length-long" id="version"/></td>
   </tr>
   
  <!--  <tr>
    <td style="text-align:right;"><b>关键词：</b></td>
    <td><input type="text" class="textBox length-long"/></td>
   </tr> -->
  
 
   <tr>
    <td style="text-align:right;"><b>是否发布：</b></td>
    <td>
     <input type="radio" name="zhandian"  value="1" checked="checked"/>是
     <input type="radio" name="zhandian"  value="0"/>否&nbsp;<span style="color:red">*若此处选《是》,保存后直接推送到用户手机</span>
    </td>
   </tr>
   <tr>
    <td style="text-align:right;"><b>更新内容：</b></td>
    <td>
     <textarea class="textarea" id="content"></textarea>
    </td>
   </tr>
   <tr>
    <td style="text-align:right;"></td>
    <td><input type="button" value="保存" class="tdBtn" onclick="return addbasic()"/></td>
   </tr>
  </table>
 </div>
 <script type="text/javascript">
 
 function addbasic() {
	 
	 	var make=$("input[name='zhandian']:checked").val();
		var version=$("#version").val();
		var content=$("#content").val();
	 var msg = "您确定要保存吗？\n\n请确认！";

		var str=${admin.jurisdiction};
		if(version==null||version==""||content==null||content==""){
			alert("内容不能为空");
		}else{
			
		
		if(str==1){
			alert("权限不足");
			return false;
		}else{
		
			if(confirm(msg)==true){
				$.ajax({
					"url":"${pageContext.request.contextPath}/Administrators/basic_settings1.do",
					"data":{"make":make,"version":version,"content":content},
					"type":"POST",
					"dataType":"json",
					"success":function(obj){

						if(obj.state==1){
							 alert("添加成功");
							window.location="${pageContext.request.contextPath}/Administrators/basic_list.do";
							
						}else{
							 alert("添加失败");
							
						}				
					}});				
			return true;
			}else{
			return false;
			}
			
		
		}
		}
		
		
 }

 </script>
</body>
</html>